package jt.classic.app.gdzc.impl;

import jt.classic.app.gdzc.GdzcTemplate;
import jt.classic.app.gdzc.GdzcTemplateItem;

import jt.classic.system.AbstractIBigObject;

import org.limp.basework.Column;

import java.util.Map;

/**
 * 资产模板项接口实现类
 * 
 * @author mido
 *
 */
public class GdzcTemplateItemImpl extends AbstractIBigObject
    implements GdzcTemplateItem {
    /**
     * 非空校验
     */
    public final static int CHECK_BLANK = 0;

    /**
     * 值类型校验
     */
    public final static int CHECK_TYPE = 1;
    private String label;
    private String desc;
    private Column column;
    private String dvalue;
    private String ovalue;
    private String proptype;
    private String proptypename;
    private String template;
    private String type;
    private String check1;
    private String check2;

    public boolean icheck(int type) {
        // TODO Auto-generated method stub
        boolean rnt = false;

        if ((type == CHECK_BLANK) && check1.equals("1")) {
            rnt = true;
        } else if ((type == CHECK_TYPE) && check2.equals("1")) {
            rnt = true;
        }

        return rnt;
    }

    public Column icolumn() {
        // TODO Auto-generated method stub
        return this.column;
    }

    public String idesc() {
        // TODO Auto-generated method stub
        return this.desc;
    }

    public String idvalue() {
        // TODO Auto-generated method stub
        return this.dvalue;
    }

    public String ilabel() {
        // TODO Auto-generated method stub
        return this.label;
    }

    public String iovalue() {
        // TODO Auto-generated method stub
        return this.ovalue;
    }

    public String iproptype() {
        // TODO Auto-generated method stub
        return this.proptype;
    }

    public String iproptypename() {
        // TODO Auto-generated method stub
        return this.proptypename;
    }

    public String itemplateid() {
        // TODO Auto-generated method stub
        return this.template;
    }

    public String itype() {
        // TODO Auto-generated method stub
        return this.type;
    }

    public void reload(Map map) {
        if (map != null) {
            this.info = map;

            this.bigoid = (String) map.get("ITEMID");
            this.bigoname = (String) map.get("COLUMNLABEL");
            this.label = (String) map.get("COLUMNLABEL");
            this.check1 = (String) map.get("COLUMNCHK1");
            this.check2 = (String) map.get("COLUMNCHK2");
            this.ovalue = (String) map.get("COLUMNOTHER");
            this.desc = (String) map.get("COLUMNMEMO");
            this.type = (String) map.get("ITEMTYPE");
            this.column = (Column) map.get("COLUMN");
            this.dvalue = (String) map.get("COLUMNDVALUE");
            this.template = (String) map.get("TEMPID");
            this.proptype = (String) map.get("PROPKEY");       //添加模板属性id
            this.proptypename = (String) map.get("PROPLABEL"); //添加模板属性名称
        }
    }
}
